<?php							
		class CSiteInfo extends database
		{
			var $table = 'cdb_siteinfo';
			
			public function CSiteInfoList ()
			{
				$sql ="select * from {$this->table} "	;
				$this->setQuery($sql);
				$this->query();
				$arr = $this->loadAllRow();
				
				$numOfRow = mysql_affected_rows();
				
				if($numOfRow>0)
					return $arr;
				else
					return -1;	
			}
			
			
			
			public function CSiteInfoDetail ($id)
			{
				if(is_int($id))
					$sql="select * from $this->table where id='{$id}'";
				else
					$sql="select * from $this->table where name='{$id}'";
				
					
				$this->setQuery($sql);
				$this->query();
				$arr=$this->loadAllRow();
				
				$numOfRow = mysql_affected_rows();
				if($numOfRow>0)
					return $arr[0];
				else
					return -1;
			}
			
			
			
			public function CSiteInfoAdd ($id,$name ,$content,$status)
			{
				$sql = "INSERT INTO {$this->table} (`id`,`name`,`content`,`status`)
	VALUES ('{$id}','{$name}','{$content}','{$status}');";
				
				$this->setQuery($sql);
				$this->query();	
				return mysql_affected_rows();
				
			}
			
			public function CSiteInfoUpdate ($id,$name, $content,$status)
			{
				$sql = "update $this->table set name ='{$name}',content ='{$content}',status ='{$status}' where id = '{$id}' ";
			
				$this->setQuery($sql);
				$this->query();
				return mysql_affected_rows();
			}
			
			public function CSiteInfoDelete($id)
			{
				$sql="Delete from  $this->table where id='{$id}'";
				$this->setQuery($sql);
				$this->query();
				return mysql_affected_rows();
			}
			
		}
	
	
	
	?>